#!/usr/bin/python3
# -*- coding:utf-8 -*-
"""
@author: 冯佳辉
@time: 2024/7/16 10:25 AM
@Function: 场景管理测试用例
"""
import allure
from playwright.sync_api import Page, expect

from repository import sceneListObject
from utils.configParse import config


class ScenePage:
    def __init__(self, page: Page):
        self.page = page
        self.scene_manage_text_loc = page.locator(sceneListObject.scene_manage_text)

    @allure.step('进入场景管理模块')
    def navigate(self, envir):
        # 测试环境
        try:
            if envir == "test":
                self.page.goto(
                    config.get_ini_login_url('xbasetest_url') + '/console/scene/manage')
                self.scene_manage_text_loc.wait_for(state="visible")
            # stage环境
            elif envir == "stage":
                self.page.goto(config.get_ini_login_url('xbasestage_url') + '/console/scene/manage')
        except Exception as e:
            print('navigate方法存在问题，路径可能更新了', e)
